﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage<MVCLD.Helpers.PaginatedList<MVCLD.Models.Article>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Live Articles
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <h2>Live Articles</h2>
    <p>Use the search form below to filter down the results</p>
        <div id="articlesearch">
        <% using (Html.BeginForm()) { %>
            <input type="text" id="searchstring" name="searchstring" /> 
            <input type="submit" value="Search" />
        <% } %>
        </div>

    <table class="admintable">
        <tr>

            <th>
                Article Title
            </th>
            <th>
                Submitter Name
            </th>

            <th>
                Submitter IP
            </th>
            <th>
                Email
            </th>
                        <th></th>
        </tr>

    <% foreach (var item in Model) { %>
    
        <tr>
            <td>
                <%= Html.ActionLink(item.ArticleTitle, "Edit", new { id=item.ArticleID }) %> 
            </td>
            <td>
                <%= Html.Encode(item.SubmitterName) %>
            </td>
            <td>
                <%= Html.Encode(item.SubmitterIP) %>
            </td>
            <td>
                <%= Html.Encode(item.Email) %>
            </td>
            <td>
                <%= Html.ActionLink("Delete", "Delete", new { id=item.ArticleID })%>
            </td>
        </tr>
    
    <% } %>

    </table>


                <% if (Model.TotalPages > 0) { %>    
            <div class="pagination">
            <p>Page <%=Model.PageIndex + 1 %> of  <%=Model.TotalPages%> 
                <% if (Model.HasPreviousPage) { %>
                    <%= Html.ActionLink("Previous", "LiveArticles", new { p = (Model.PageIndex - 1) })%>
                <% } %>
                
                <% if (Model.HasNextPage) { %>
                    <%= Html.ActionLink("Next", "LiveArticles", new { p = (Model.PageIndex + 1) })%>        
                <% } %></p>
            </div>    
        <% } %>

</asp:Content>

